package com.example.chapter06;

public class Factories {
    public static void
    serviceConsumer(ServiceFactory fact) {
        Service s = fact.getService();
        s.method1();
        s.method2();
    }

    public static void main(String[] args) {
        serviceConsumer(new ServicelFactory());
        //服务是完全可以互换的：
        serviceConsumer(new Service2Factory());
    }
}
